
<template>
<div class="ZJYSearchPage-page">
<div v-for="(item,index) in listData" :key="0" class="ZJYSearchPage-itemview">
  <div class="ZJYSearchPage-item" @click="serchItemClick(item)">
    <div class="ZJYSearchPage-itemdiv1 ZJYSearchPage-itemdiv1-color">{{getType(item)}}</div>
    <div class="ZJYSearchPage-itemdiv1">{{item.entityName}}</div>
  </div>
  <div class="ZJYSearchPage-line"> </div>
</div>
</div>
</template>

<script setup>
import '@/views/zhuanjiyin/css/ZJYSearchPage.css'
import uiUtil from "@/util/UiUtil.js";
import {reactive, onMounted, inject, ref, markRaw, provide, watch} from "vue";
const props = defineProps({
  searchVal: String,
  serchItemClick: Function//弹出框数据
});
onMounted(()=>{
  getList()
})
var user=uiUtil.getUser()
const listData=ref([])
const getList = () => {
  // debugger
  uiUtil.http().getObj({
    url: uiUtil.urlPath.zjysearch,
    data: {
      "searchVal":props.searchVal,//
      "region": user.RegManageRegionID,//
    },
    start: function start() {
      uiUtil.toastLoading()
    },
    succeed: function succeed(res) {
      if (200 != res.code) {
        uiUtil.toastFail(res.msg)
        return
      }
      listData.value=res.data
      listData.value.push(...res.data)
      // console.log('listData=', listData.value)
    },
    failed: function failed(res) {
    },
    finish: function finish() {
      uiUtil.toastClose()
    }
  })
};
const getType = (item) => {
  if (1==item.type)return '区域'
  if (2==item.type)return '品种'
  if (3==item.type)return '种子企业'
  if (4==item.type)return '性状公司'
  if (5==item.type)return '备案者'
  if (6==item.type)return '农户'
}
</script>

<style scoped lang="less">

</style>